# Contributor: Leon ROUX <leon.roux@federate.us>
# Maintainer: Leon ROUX <leon.roux@federate.us>
pkgname=sdrangel
pkgver=7.20.0
pkgrel=1
pkgdesc="SDR Rx/Tx software and analyzer for various hardware"
url="https://github.com/f4exb/sdrangel"
license="GPL-3.0-or-later"
# cm256cc
arch="aarch64 x86_64"
depends="
	qt5-qtquickcontrols
	qt5-qtquickcontrols2
	qt5-qtgraphicaleffects
	"
makedepends="
	aptdec-dev
	boost-dev
	cm256cc-dev
	cmake
	faad2-dev
	ffmpeg-dev
	fftw-dev
	hackrf-dev
	librtlsdr-dev
	libusb-dev
	opencv-dev
	opus-dev
	qt5-qtbase-dev
	qt5-qtcharts-dev
	qt5-qtgamepad-dev
	qt5-qtlocation-dev
	qt5-qtmultimedia-dev
	qt5-qtserialport-dev
	qt5-qtspeech-dev
	qt5-qtsvg-dev
	qt5-qtwebengine-dev
	qt5-qtwebsockets-dev
	samurai
	serialdv-dev
	soapy-sdr-dev
	uhd-dev
	"
source="$pkgname-$pkgver.tar.gz::https://github.com/f4exb/sdrangel/archive/refs/tags/v$pkgver.tar.gz
	no-march-magic.patch
	"

build() {
	CFLAGS="$CFLAGS -O2 -flto=auto" \
	CXXFLAGS="$CXXFLAGS -O2 -flto=auto" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DDEBUG_OUTPUT=ON \
		-DENABLE_AIRSPY=OFF \
		-DENABLE_AIRSPYHF=OFF \
		-DENABLE_BLADERF=OFF \
		-DENABLE_FUNCUBE=OFF \
		-DENABLE_HACKRF=ON \
		-DENABLE_IIO=OFF \
		-DENABLE_LIMESUITE=OFF \
		-DENABLE_MIRISDR=OFF \
		-DENABLE_PERSEUS=OFF \
		-DENABLE_RTLSDR=ON \
		-DENABLE_SDRPLAY=OFF \
		-DENABLE_SOAPYSDR=ON \
		-DENABLE_XTRX=OFF \
		-DENABLE_PACK_MIRSDRAPI=OFF \
		-DENABLE_USRP=OFF
	cmake --build build
}

check() {
	cd build
	CTEST_OUTPUT_ON_FAILURE=TRUE ctest
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
e808cf5a564d1c90c27c2eaf663268686de854d054b77419e34d20613990abad64484a8a46a7ca6777aeadf420e098693758783eb36872da0472e1338b68c54a  sdrangel-7.20.0.tar.gz
8779ed53c83505df3dac7a0b0a485c939f439a01f5aed203e25652cdb7d17c10ee629fab75b22b1ac9de882bfefbddcf2af5a3a8da75c5fdefc007a8fb9480f8  no-march-magic.patch
"
